package com.tnovoselec.server.gdjejefrka;

import java.io.File;

import org.apache.catalina.startup.Tomcat;

public class Main {
	
	public static void main(String[] args) throws Exception {
//	    String webappDirLocation = "/usr/local/GdjeJeFrka/server/war/";
		 String webappDirLocation = "war/";
        Tomcat tomcat = new Tomcat();

      
        String webPort = System.getenv("PORT");
        if(webPort == null || webPort.isEmpty()) {
            webPort = "2222";
        }

        tomcat.setPort(Integer.valueOf(webPort));

        tomcat.addWebapp("/", new File(webappDirLocation).getAbsolutePath());

        System.out.println("configuring app with basedir: " + new File("" + webappDirLocation).getAbsolutePath());

       
        
        tomcat.start();
        tomcat.getServer().await();  
	}

}
